﻿namespace MiniCore;

public interface IWebHost
{
    Task StartAsync();
}

public class WebHost : IWebHost
{
    private readonly IServer _server;
    private readonly RequestDelegate _handler;
    public WebHost(IServer server, RequestDelegate handler)
    {
        _server = server;
        _handler = handler;
    }

    /// <summary>
    /// WebHost构建的管道由Server和HttpHandler构成
    /// </summary>    
    public Task StartAsync() => _server.StartAsync(_handler);
}
